@extends('admin.layouts.master')

@section('content')

<div class="row aw-list">
	<div class="col-md-12">
		<section class="row form-inline aw-list-head">
			<div class="col-sm-4">
				<div class="aw-head-add">
					<a class="btn btn-gules" href="/admin/admin/info?page_id=15&id=add"><i class="icon-plus"></i> 添加管理员</a>
				</div>
			</div>
			<div class="col-sm-8">
				<div class="aw-head-search">
					<div class="form-group">
						<input type="text" class="form-control" placeholder="请输入管理员姓名" id="SearchText" v-on:keyup.enter="List_Search()">
					</div>
					<a class="btn btn-green" v-on:click="List_Search()"><i class="icon-search"></i> 搜索</a>
				</div>
			</div>
		</section>
	</div>
	<div class="col-lg-12">
		<section class="panel aw-content">
			<header class="panel-heading">管理员列表</header>
			<table class="table table-striped dataTable table-hover">
				<thead>
					<tr>
						<th>ID</th>
						<th>姓名</th>
						<th>手机号</th>
						<th>职位</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="(list,key)  in lists">
						<td>@{{list.id - 1}}</td>
						<td>@{{list.name}}</td>
						<td>@{{list.phone}}</td>
						<td>@{{list.join_text}}</td>
						<td>@{{list.status_text}}</td>
						<td>
							<button class="btn btn-green btn-xs" v-on:click="List_Edit(list.id)">
								<i class="icon-pencil"></i> 编辑
							</button>
							<button class="btn btn-gules btn-xs" v-on:click="List_Status_Edit(list.id,2,'禁用')" v-if="list.status==1">
								<i class="icon-remove"></i> 禁用
							</button>
							<button class="btn btn-green btn-xs" v-on:click="List_Status_Edit(list.id,1,'启用')" v-if="list.status==2">
								<i class="icon-ok"></i> 启用
							</button>
						</td>
					</tr>
				</tbody>
			</table>
			<div class="aw-text-center aw-list-null" v-if="lists.length==0">暂无数据</div>
			<vue-page :page_item="page_item" :page_this="page_this" :page_all="page_all" :Call_back="Call_back"></vue-page>
		</section>
	</div>
</div>

@section('pagejs')
@parent

<script type="text/javascript" src="/admin/js/vue-page.js"></script>
<script type="text/javascript" src="/admin/js/page.js"></script>
<script type="text/javascript">
var MJS_URLArry=URLArry;
var AD_list={
	api:'/adminapi/admin/admin-list',
	form_data:MJS_URLArry,
	tips:false,
}
var Ajax_Vue_Fun=function(vue_data){
	console.log('vue_data')
	console.log(vue_data)
	var Data_Vue=ajax_data_res(vue_data)
	vm=new Vue({
		el:'#Vue-Body',
		data:Data_Vue,
		components:{
			'vue-page':Vpage
		},methods:{
			Call_back:function(page){
				Vm_Call_back_Page(page)
			},List_Status_Edit:function(id,status,tips){
				var AD_status={
					api:'/adminapi/admin/admin-status',
					form_data:{id:id,status:status},
					tips:tips+'成功',
					msg:'是否'+tips+'该管理员？',
				}
				Vm_List_Status(AD_status)
			},List_Edit:function(id){
				//用户信息
				location.href='/admin/admin/info?page_id=14&id='+id;
			},List_Search:function(){
				Vm_List_SearchText('管理员')
			},Console_Log:function(){
				console.warn('Vue-function:打印vue事件');
				console.log(this)
				console.log(this.lists)
			}
		}
	})
	console.log(vm)
}
getData(AD_list,Ajax_Vue_Fun)
</script>
@endsection

@endsection

